package com.nbsaas.boot.manufacturing.rest.resource;

import com.nbsaas.boot.manufacturing.api.apis.EquipmentApi;
import com.nbsaas.boot.manufacturing.data.entity.Equipment;
import com.nbsaas.boot.manufacturing.api.domain.request.EquipmentRequest;
import com.nbsaas.boot.manufacturing.api.domain.response.EquipmentResponse;
import com.nbsaas.boot.manufacturing.api.domain.simple.EquipmentSimple;
import com.nbsaas.boot.manufacturing.rest.convert.EquipmentSimpleConvert;
import com.nbsaas.boot.manufacturing.rest.convert.EquipmentEntityConvert;
import com.nbsaas.boot.manufacturing.rest.convert.EquipmentResponseConvert;
import com.nbsaas.boot.manufacturing.data.repository.EquipmentRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   设备-业务接口实现
*/
@Transactional
@Service
public class EquipmentResource extends BaseResource<Equipment,EquipmentResponse, EquipmentSimple, EquipmentRequest>  implements EquipmentApi {

    @Resource
    private EquipmentRepository equipmentRepository;

    @Override
    public JpaRepositoryImplementation<Equipment, Serializable> getJpaRepository() {
        return equipmentRepository;
    }

    @Override
    public Function<Equipment, EquipmentSimple> getConvertSimple() {
        return new EquipmentSimpleConvert();
    }

    @Override
    public Function<EquipmentRequest, Equipment> getConvertForm() {
        return new EquipmentEntityConvert();
    }

    @Override
    public Function<Equipment, EquipmentResponse> getConvertResponse() {
        return new EquipmentResponseConvert();
    }




}


